package plantshop.tests;

import static org.junit.Assert.*;

import java.util.ArrayList;

import javax.swing.JFrame;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import plantshop.model.Opponent;
import plantshop.model.Player;

public class PlayerTest {
	Player test;

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
		test = new Player("Test Player",true,null,new JFrame(),null);
	}

	@After
	public void tearDown() throws Exception {
		
	}

	@Test
	public void testPlayer() {
		assertEquals(true,test.getGender());
		assertEquals("Test Player",test.getName());
		assertEquals(100,test.getMoney());
		assertEquals(new ArrayList<Opponent>(),test.getOpponents());
		assertEquals(500,test.getStoreAttractiveness());
		
		test.setName("New Name");
		test.setGender(false);
		test.setMoney(5000);
		test.setScore(400);
		test.addOpponent(true, "Opponent One");
		
		assertEquals("New Name",test.getName());
		assertEquals(false,test.getGender());
		assertEquals(5000,test.getMoney());
		assertEquals(400,test.getStoreAttractiveness());
		assertEquals(1,test.getOpponents().size());
		
		test.updateTotalScore();
	}
	
	@Test
	public void testStartGame(){
		test.startGame();
	}
}
